package com.dailyblue.project.estate.config;

import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
import org.springframework.ai.chat.memory.ChatMemory;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Auther:Liu
 * @Testname:ChatClientConfig
 * @Date:2025/9/26 10:44
 */

/**
 * 大模型配置
 */
@Configuration
public class ChatClientConfig {
    @Resource
    private OllamaChatModel ollamaChatModel;
    @Resource
    private ChatMemory jdbcChatMemory;

    @Bean("ollamaChatClient")
    public ChatClient ollamaChatClient() {
        return  ChatClient
                .builder(ollamaChatModel)
                .defaultSystem("你是慧敏,来自霍格沃兹,是一名魔法师")
                .defaultAdvisors(new MessageChatMemoryAdvisor(jdbcChatMemory))
                .build();
    }
}
